package org.sbbs.demo.webapp.action;

import java.util.List;

import org.sbbs.base.search.PropertySearchBuilder;
import org.sbbs.base.webapp.action.BaseAction;
import org.sbbs.base.webapp.action.BaseGridAction;
import org.sbbs.demo.model.DemoEntity;
import org.sbbs.demo.service.DemoEntityManager;

import com.googlecode.genericdao.search.Search;
import com.googlecode.genericdao.search.SearchResult;

/**
 * @author Administrator
 */
public class DemoLigerPagedAction
    extends BaseGridAction {

    /*
     * public String edit(){ if(this.id==null) demoEntity=new DemoEntity(); else demoEntity =
     * this.demoEntityManager.find( this.id ); return this.SUCCESS; }
     */

    public String gridPageList() {
        Search search = PropertySearchBuilder.BuildSearch( getRequest() );
        SearchResult srt = this.demoEntityManager.searchAndCount( search );
        this.setPageList( srt.getResult() );
        this.total = srt.getTotalCount();
        return this.SUCCESS;
    }

    /*
     * public Integer getPage() { return page; } public void setPage( Integer page ) { this.page = page; }
     */

    /*
     * public Integer getTotal() { return total; } public void setTotal( Integer total ) { this.total = total; }
     */

    /*
     * public Integer getRecords() { return records; } public void setRecords( Integer records ) { this.records =
     * records; }
     */
    /*
     * public List getPageList() { return pageList; } public void setPageList( List pageList ) { this.pageList =
     * pageList; }
     */
    public DemoEntityManager getDemoEntityManager() {
        return demoEntityManager;
    }

    public void setDemoEntityManager( DemoEntityManager demoEntityManager ) {
        this.demoEntityManager = demoEntityManager;
    }

    // protected Integer page = 0;

    // protected Integer total = 0;

    // protected Integer records = 0;

    // protected List pageList;

    private DemoEntityManager demoEntityManager;

}
